﻿namespace WinForms.ControlList.Sales
{
    using Bll.Company;
    using Bll.Guest;
    using Bll.Sales;
    using Bll.Stock;
    using Bll.Systems;
    using Library;
    using Model.Company;
    using Model.Guest;
    using Model.Sales;
    using Model.Systems;
    using PublicStaticClass.UIControl;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;
    using WinForms;
    using WinForms.Properties;

    public class FrmOrdersList : WindowBase
    {
        private DataGridViewTextBoxColumn BlackManName;
        private DataGridViewTextBoxColumn BlackTime;
        private Button btn_SeeZj;
        private Button btn_ZuoFei;
        private Button btnAddNew;
        private Button btnChongAll;
        private Button btnDelele;
        private Button btnSearch;
        private Button btnSearchHidden;
        private Button btnSelectAll;
        private string[] checkPopIsUse = new string[5];
        private string[] CheckPopName = new string[] { "NewOrders", "EditOrders", "DeleteOrders", "CheckOrders", "ZuoFeiOrders" };
        private DataGridViewCheckBoxColumn chk_chkItem;
        private CheckBox chk_IsQuHuo;
        private CheckBox chk_IsZuoFei;
        private CheckBox chk_ShouKuan;
        private IContainer components = null;
        private DataGridViewTextBoxColumn CreateTime;
        private DataGridView DataGridList;
        private DateTimePicker dateTime_BeginTime;
        private DateTimePicker dateTime_EndTime;
        private DataGridViewTextBoxColumn dgAddresses;
        private DataGridViewTextBoxColumn dgChainNum;
        private DataGridViewTextBoxColumn dgCheckMan;
        private DataGridViewTextBoxColumn dgCheckTime;
        private DataGridViewTextBoxColumn dgClearingType;
        private DataGridViewTextBoxColumn dgCostMoney;
        private DataGridViewTextBoxColumn dgCreateTime;
        private DataGridViewTextBoxColumn dgDistrType;
        private DataGridViewTextBoxColumn dgFollowUpDeal;
        private DataGridViewTextBoxColumn dgGuestId;
        private DataGridViewTextBoxColumn dgInvoicingNum;
        private DataGridViewTextBoxColumn dgIsBlackOut;
        private DataGridViewTextBoxColumn dgIsCheck;
        private DataGridViewTextBoxColumn dgIsInvoicing;
        private DataGridViewTextBoxColumn dgIsOut;
        private DataGridViewTextBoxColumn dgIsRequestRetrun;
        private DataGridViewTextBoxColumn dgIsReturn;
        private DataGridViewTextBoxColumn dgIsReview;
        private DataGridViewTextBoxColumn dgIsUseReturn;
        private DataGridViewTextBoxColumn dgLinkMan;
        private DataGridViewTextBoxColumn dgLinkTel;
        private DataGridViewTextBoxColumn dgLogisticsId;
        private DataGridViewTextBoxColumn dgLogisticsName;
        private DataGridViewTextBoxColumn dgLogisticsNum;
        private DataGridViewTextBoxColumn dgNotReason;
        private DataGridViewTextBoxColumn dgOpenType;
        private DataGridViewTextBoxColumn dgOrderNum;
        private DataGridViewTextBoxColumn dgOrdersId;
        private DataGridViewTextBoxColumn dgPaidMoney;
        private DataGridViewTextBoxColumn dgProcurementId;
        private DataGridViewTextBoxColumn dgReason;
        private DataGridViewTextBoxColumn dgRemark;
        private DataGridViewTextBoxColumn dgReturnMoney;
        private DataGridViewTextBoxColumn dgReturnTime;
        private DataGridViewTextBoxColumn dgReviewMan;
        private DataGridViewTextBoxColumn dgReviewTime;
        private DataGridViewTextBoxColumn dgSaleVtag;
        private DataGridViewTextBoxColumn dgSentProMoney;
        private DataGridViewTextBoxColumn dgShipmentsType;
        private DataGridViewTextBoxColumn dgToMeetMoney;
        private DataGridViewTextBoxColumn dgUserId;
        private DataGridViewTextBoxColumn dgZipCode;
        private ComboBoxNew drpUserList;
        private DataGridViewTextBoxColumn GuestId;
        private DataGridViewImageColumn imgDelete;
        private DataGridViewImageColumn imgEdit;
        private DataGridViewTextBoxColumn IsBlackOut;
        private Label label1;
        private Label label2;
        private Label label3;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label lbl_CreateTime;
        private Label lbl_GuestName;
        private Label lbl_Idcoument;
        private Label lblWhere;
        private Navigator navigator_Page;
        private DataGridViewTextBoxColumn OrderNum;
        private DataGridViewTextBoxColumn OrdersId;
        private Panel pan_AllPanel;
        private Panel pan_AllPlanes;
        private Panel pan_Bottoms;
        private Panel pan_Dock;
        private Panel pan_DockBottom;
        private Panel pan_DockLeft;
        private Panel pan_DockRight;
        private Panel pan_Lefts;
        private Panel pan_Rights;
        private Panel pan_Top;
        private Panel pan_TopJianGe;
        private Panel pan_TopLeft;
        private Panel pan_TopRight;
        private Panel pan_ZhongJian;
        private Panel pane_TopT;
        private Panel panel1;
        private Panel panel10;
        private Panel panel11;
        private Panel panel12;
        private Panel panel13;
        private Panel panel14;
        private Panel panel15;
        private Panel panel16;
        private Panel panel17;
        private Panel panel18;
        private Panel panel19;
        private Panel panel2;
        private Panel panel20;
        private Panel panel21;
        private Panel panel22;
        private Panel panel23;
        private Panel panel24;
        private Panel panel25;
        private Panel panel26;
        private Panel panel27;
        private Panel panel28;
        private Panel panel3;
        private Panel panel30;
        private Panel panel31;
        private Panel panel4;
        private Panel panel5;
        private Panel panel6;
        private Panel panel7;
        private Panel panel8;
        private Panel panel9;
        private PictureBox pic_Help;
        private Panel PlSearch;
        private Panel PlSearch2;
        public FrmPrompt prom = null;
        private DataGridViewTextBoxColumn SaleVtag;
        private DataGridViewTextBoxColumn ToMeetMoney;
        private TextBox txt_BeginMoney;
        private TextBox txt_EndMoney;
        private TextBox txt_GuestName;
        private TextBox txt_IdDocument;
        private DataGridViewTextBoxColumn UserId;

        public FrmOrdersList()
        {
            this.InitializeComponent();
            base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            base.SetStyle(ControlStyles.UserPaint, true);
            base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.dateTime_BeginTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-01"));
            if (PublicAppliction.configEnt.IsUseHelp == 1)
            {
                this.pic_Help.Visible = true;
            }
            else
            {
                this.pic_Help.Visible = false;
            }
            this.DataGridList.ClearSelection();
        }

        private void AddLinkOrdersAndPayment(int ordersId, int payMentId, decimal money)
        {
            OrdersPayMentListEnt model = new OrdersPayMentListEnt {
                OrdersId = ordersId,
                PaymentId = payMentId,
                PayMentMoney = money
            };
            OrdersPayMentListBll.Add(model);
        }

        private void btn_SeeZj_Click(object sender, EventArgs e)
        {
            try
            {
                string str = "";
                string[] strArray = this.GetSelectId(0).Split(new char[] { ',' });
                foreach (string str2 in strArray)
                {
                    if (str2 != "")
                    {
                        OrdersEnt model = OrdersBll.GetModel(int.Parse(str2));
                        if (model != null)
                        {
                            if (model.IsCheck == 0)
                            {
                                bool flag = false;
                                bool flag2 = false;
                                flag = this.StockCommOutPut(str2);
                                if (!flag)
                                {
                                    return;
                                }
                                GuestEnt ent2 = GuestBll.GetModel(model.GuestId);
                                ent2.CumulativeMoney += model.ToMeetMoney;
                                ent2.OutstMoney += model.ToMeetMoney;
                                ent2.PaidMoney = ent2.CumulativeMoney - ent2.OutstMoney;
                                ent2.ConsumeNum++;
                                GuestBll.Update(ent2);
                                if (MessageBox.Show("是否自动结算并打印销售单据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    FrmSelectPayMent ment = new FrmSelectPayMent();
                                    if ((ment.ShowDialog() == DialogResult.OK) && flag)
                                    {
                                        flag2 = this.PayForMyMoney(str2.ToString(), ment.AccountId, ment.payType);
                                        UserEnt loginUser = PublicAppliction.LoginUser;
                                        model.IsCheck = 1;
                                        model.CheckMan = loginUser.UserId;
                                        model.CheckTime = DateTime.Now;
                                        model.OrdersId = int.Parse(str2);
                                        OrdersBll.Check(model);
                                        GuestEnt ent4 = GuestBll.GetModel(model.GuestId);
                                        ent4.PaidMoney += model.ToMeetMoney;
                                        ent4.OutstMoney = ent4.CumulativeMoney - ent4.PaidMoney;
                                        GuestBll.Update(ent4);
                                    }
                                    new FrmOrdersPrint(int.Parse(str2)).Show();
                                }
                            }
                            else
                            {
                                str = str + model.OrderNum;
                            }
                        }
                    }
                }
                if (str == "")
                {
                }
                this.prom = new FrmPrompt(true, "销售信息已确认!");
                this.prom.Show();
                this.DataGrid_bind();
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }

        private void btn_ZuoFei_Click(object sender, EventArgs e)
        {
            try
            {
                string str = "";
                string str2 = "";
                for (int i = 0; i < this.DataGridList.Rows.Count; i++)
                {
                    if (this.DataGridList.Rows[i].Cells[0].FormattedValue.ToString() == "True")
                    {
                        OrdersEnt model = OrdersBll.GetModel(int.Parse(this.DataGridList.Rows[i].Cells[1].Value.ToString()));
                        if ((model.IsOut == 1) && (model.IsBlackOut == 0))
                        {
                            if (!OrdersBll.SalesReturn(int.Parse(this.DataGridList.Rows[i].Cells[1].Value.ToString())))
                            {
                                str = str + this.DataGridList.Rows[i].Cells[1].Value + ",";
                            }
                        }
                        else
                        {
                            str2 = str2 + this.DataGridList.Rows[i].Cells[1].Value + ",";
                        }
                    }
                }
                if (str != "")
                {
                    FrmPrompt prompt = new FrmPrompt(false, "以下单据作废失败:" + str + "\n") {
                        Width = 600,
                        Height = 300
                    };
                    prompt.ShowDialog();
                }
                if (str2 != "")
                {
                    new FrmPrompt(false, "以下单据货物未出库:" + str2 + "\n请直接使用删除功能,删除单据") { Width = 500, Height = 300 }.ShowDialog();
                }
                this.btnSearch_Click(null, null);
                WorkLogBll.AddNewLog("作废 编号:" + str, "", PublicAppliction.LoginUser);
            }
            catch (Exception exception)
            {
                ErrorsBll.NewException(exception, PublicAppliction.LoginUser);
            }
        }

        private void btnAddNew_Click(object sender, EventArgs e)
        {
            FrmOrdersAdd add = new FrmOrdersAdd();
            if (DialogResult.OK == add.ShowDialog())
            {
                this.DatePageReadLoad();
            }
            add.Dispose();
        }

        private void btnChongAll_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.DataGridList.Rows.Count; i++)
            {
                this.DataGridList.Rows[i].Cells[0].Value = "False";
            }
        }

        private void btnDelele_Click(object sender, EventArgs e)
        {
            try
            {
                string str = "";
                string str2 = "";
                for (int i = 0; i < this.DataGridList.Rows.Count; i++)
                {
                    if (this.DataGridList.Rows[i].Cells[0].FormattedValue.ToString() == "True")
                    {
                        OrdersEnt model = OrdersBll.GetModel(int.Parse(this.DataGridList.Rows[i].Cells[1].Value.ToString()));
                        if (model.IsOut == 0)
                        {
                            OrdersBll.Delete(int.Parse(this.DataGridList.Rows[i].Cells[1].Value.ToString()));
                            DataTable list = OrdersCommBll.GetList("OrdersId=" + this.DataGridList.Rows[i].Cells[1].Value.ToString());
                            foreach (DataRow row in list.Rows)
                            {
                                OrdersBll.Delete(int.Parse(row["SaleCommId"].ToString()));
                            }
                            str = str + this.DataGridList.Rows[i].Cells[1].Value + ",";
                        }
                        else
                        {
                            str2 = str2 + model.OrderNum + "\n";
                        }
                    }
                }
                if (str2 != "")
                {
                    new FrmPrompt(false, "以下单据货物已出库无法删除:" + str2 + "\n您可以通过作废功能来作废此单据.\n\n作废后的货物会自动回到库存,所入帐户款项也会被扣除!") { Width = 600, Height = 400 }.ShowDialog();
                }
                this.DatePageReadLoad();
                WorkLogBll.AddNewLog("删除销售信息 编号:" + str, "", PublicAppliction.LoginUser);
            }
            catch (Exception exception)
            {
                ErrorsBll.NewException(exception, PublicAppliction.LoginUser);
            }
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            string text;
            UserEnt loginUser = PublicAppliction.LoginUser;
            this.lblWhere.Text = " where ChainNum=" + loginUser.ChainNum;
            if (this.txt_IdDocument.Text != "")
            {
                this.lblWhere.Text = this.lblWhere.Text + " and OrderNum like '%" + this.txt_IdDocument.Text + "%'";
            }
            if ((this.txt_BeginMoney.Text != "") && (this.txt_EndMoney.Text != ""))
            {
                text = this.lblWhere.Text;
                this.lblWhere.Text = text + " and ToMeetMoney>=" + this.txt_BeginMoney.Text + " and ToMeetMoney<=" + this.txt_EndMoney.Text;
            }
            else if ((this.txt_BeginMoney.Text == "") && (this.txt_EndMoney.Text != ""))
            {
                this.lblWhere.Text = this.lblWhere.Text + " and ToMeetMoney<=" + this.txt_EndMoney.Text;
            }
            else if ((this.txt_BeginMoney.Text != "") && (this.txt_EndMoney.Text == ""))
            {
                this.lblWhere.Text = this.lblWhere.Text + " and ToMeetMoney>=" + this.txt_BeginMoney.Text;
            }
            if (this.txt_GuestName.Text != "")
            {
                this.lblWhere.Text = this.lblWhere.Text + " and GuestName like '%" + this.txt_IdDocument.Text + "%'";
            }
            if ((this.dateTime_BeginTime.Value.ToString() != "") && (this.dateTime_EndTime.Value.ToString() != ""))
            {
                text = this.lblWhere.Text;
                this.lblWhere.Text = text + " and CreateTime between #" + this.dateTime_BeginTime.Value.ToString("yyyy-MM-dd 00:00:00") + "# and #" + this.dateTime_EndTime.Value.ToString("yyyy-MM-dd 23:59:59") + "#";
            }
            else if ((this.dateTime_BeginTime.Value.ToString() == "") && (this.dateTime_EndTime.Value.ToString() != ""))
            {
                this.lblWhere.Text = this.lblWhere.Text + " and  CreateTime <=#" + this.dateTime_EndTime.Value.ToString("yyyy-MM-dd 23:59:59") + "#";
            }
            else if ((this.dateTime_BeginTime.Value.ToString() != "") && (this.dateTime_EndTime.Value.ToString() == ""))
            {
                this.lblWhere.Text = this.lblWhere.Text + " and  CreateTime >=#" + this.dateTime_BeginTime.Value.ToString("yyyy-MM-dd 00:00:00") + "#";
            }
            if (this.drpUserList.SelectValueNew != "")
            {
                this.lblWhere.Text = this.lblWhere.Text + " and UserId=" + this.drpUserList.SelectValueNew;
            }
            if (this.chk_IsQuHuo.Checked)
            {
                this.lblWhere.Text = this.lblWhere.Text + " and  isout=1";
            }
            else
            {
                this.lblWhere.Text = this.lblWhere.Text + " and isout=0";
            }
            if (this.chk_ShouKuan.Checked)
            {
                this.lblWhere.Text = this.lblWhere.Text + " and  SaleVtag=2";
            }
            if (this.chk_IsZuoFei.Checked)
            {
                this.lblWhere.Text = this.lblWhere.Text + " and IsBlackOut=1";
                this.DataGridList.Columns["BlackManName"].Visible = true;
                this.DataGridList.Columns["BlackTime"].Visible = true;
            }
            else
            {
                this.DataGridList.Columns["BlackManName"].Visible = false;
                this.DataGridList.Columns["BlackTime"].Visible = false;
            }
            this.DatePageReadLoad();
        }

        private void btnSearchHidden_Click(object sender, EventArgs e)
        {
            if (this.PlSearch.Visible)
            {
                this.btnSearchHidden.Text = "显示查询";
                this.PlSearch2.Visible = false;
                this.PlSearch.Visible = false;
            }
            else
            {
                this.btnSearchHidden.Text = "隐藏查询";
                this.PlSearch2.Visible = true;
                this.PlSearch.Visible = true;
            }
        }

        private void btnSelectAll_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.DataGridList.Rows.Count; i++)
            {
                if (this.DataGridList.Rows[i].Cells[0].FormattedValue.ToString() == "True")
                {
                    this.DataGridList.Rows[i].Cells[0].Value = "False";
                }
                else
                {
                    this.DataGridList.Rows[i].Cells[0].Value = "True";
                }
            }
        }

        protected void CheckPayment(string maxid, string ordersId)
        {
            try
            {
                if (maxid.Trim() != "")
                {
                    OrderPaymentEnt model = OrderPaymentBll.GetModel(int.Parse(maxid));
                    bool flag = true;
                    if (model.IsCheck == 0)
                    {
                        OrdersEnt ordersEnt = OrdersBll.GetModel(int.Parse(ordersId));
                        ordersEnt.SaleVtag = 2;
                        OrdersBll.UpdateSaleVag(ordersEnt);
                        UserEnt loginUser = PublicAppliction.LoginUser;
                        if (flag)
                        {
                            CompayAccountDetailsEnt ent4 = new CompayAccountDetailsEnt {
                                CreateMan = loginUser.UserId,
                                CreateTime = DateTime.Now,
                                //ChainNum = loginUser.ChainNum,
                                DetailsType = 4,
                                InputDetailsSource = model.AccountId,
                                NotesNum = model.PaymentNum,
                                Remark = model.Remark,
                                ChainNum = loginUser.ChainNum,
                                BuildMoney = ordersEnt.ToMeetMoney
                            };
                            CompayAccountDetailsBll.Add(ent4);
                            ent4.DetailsId = CompayAccountDetailsBll.GetMaxId("ChainNum=" + loginUser.ChainNum);
                            ent4.IsCheck = 1;
                            ent4.CheckMan = loginUser.UserId;
                            ent4.CheckTime = DateTime.Now;
                            CompayAccountDetailsBll.Check(ent4);
                            CompayAccountEnt ent5 = CompayAccountBll.GetModel(model.AccountId);
                            ent5.AccountMoney += ent4.BuildMoney;
                            CompayAccountBll.Update(ent5);
                        }
                        loginUser = PublicAppliction.LoginUser;
                        model.CheckMan = loginUser.UserId;
                        model.IsCheck = 1;
                        model.CheckTime = DateTime.Now;
                        OrderPaymentBll.Check(model);
                    }
                }
            }
            catch (Exception)
            {
            }
        }

        protected void DataGrid_bind()
        {
            try
            {
                DataTable dt = new DataTable();
                int pageCurrent = this.navigator_Page.PageCurrent;
                if (this.lblWhere.Text != "")
                {
                    dt = OrdersBll.GetPageList(PublicAppliction.PageCount, pageCurrent, this.lblWhere.Text);
                }
                else
                {
                    dt = OrdersBll.GetPageList(PublicAppliction.PageCount, pageCurrent, "");
                }
                int num2 = GetTableColCount.ReturnTableColCount("Systems", "T_Orders", this.lblWhere.Text);
                this.DataGridList.AutoGenerateColumns = false;
                this.DataZhuanHuan(ref dt);
                this.DataGridList.DataSource = dt;
                this.navigator_Page.DataSource = dt;
                this.navigator_Page.RowCount = num2;
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }

        private void DataGridList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                string str;
                OrdersEnt model;
                if (e.ColumnIndex == this.DataGridList.Columns["imgEdit"].Index)
                {
                    str = this.DataGridList.Rows[e.RowIndex].Cells[1].Value.ToString();
                    model = OrdersBll.GetModel(int.Parse(str));
                    if ((model.IsBlackOut != 1) && (model.IsOut == 0))
                    {
                        FrmOrdersEdit edit = new FrmOrdersEdit(int.Parse(str));
                        if (DialogResult.OK == edit.ShowDialog())
                        {
                            this.DatePageReadLoad();
                        }
                        edit.Dispose();
                    }
                    else
                    {
                        FrmPrompt prompt = new FrmPrompt(false, "以下单据货物已出库无法修改:" + model.OrderNum + "\n\n您可以通过作废功能来作废此单据,后重新开单!") {
                            Width = 650,
                            Height = 400
                        };
                        prompt.ShowDialog();
                    }
                }
                else if (e.ColumnIndex == this.DataGridList.Columns["imgDelete"].Index)
                {
                    str = this.DataGridList.Rows[e.RowIndex].Cells[1].Value.ToString();
                    model = OrdersBll.GetModel(int.Parse(str));
                    if (model.IsOut == 0)
                    {
                        if (DialogResult.OK == MessageBox.Show("您确定要删除这条记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk))
                        {
                            DataTable list = OrdersCommBll.GetList("OrdersId=" + str);
                            foreach (DataRow row in list.Rows)
                            {
                                OrdersBll.Delete(int.Parse(row["SaleCommId"].ToString()));
                            }
                            OrdersBll.Delete(int.Parse(str));
                            WorkLogBll.AddNewLog("删除销售信息 编号:" + str, "", PublicAppliction.LoginUser);
                        }
                    }
                    else
                    {
                        new FrmPrompt(false, "以下单据货物已出库无法删除:" + model.OrderNum + "\n\n您可以通过作废功能来作废此单据.\n\n作废后的货物会自动回到库存,所入帐户款项也会被扣除!") { Width = 600, Height = 400 }.ShowDialog();
                    }
                    this.DatePageReadLoad();
                }
            }
        }

        private void DataGridList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                FrmOrdersVeiw veiw = new FrmOrdersVeiw(int.Parse(this.DataGridList.Rows[e.RowIndex].Cells[1].Value.ToString()));
                if (DialogResult.OK == veiw.ShowDialog())
                {
                    this.DataGrid_bind();
                }
                veiw.Dispose();
            }
        }

        protected void DataZhuanHuan(ref DataTable dt)
        {
            dt.Columns["GuestId"].ColumnName = "GuestId1";
            dt.Columns["UserId"].ColumnName = "UserId1";
            dt.Columns["SaleVtag"].ColumnName = "SaleVtag1";
            dt.Columns["IsBlackOut"].ColumnName = "IsBlackOut1";
            dt.Columns.Add("GuestId");
            dt.Columns.Add("UserId");
            dt.Columns.Add("SaleVtag");
            dt.Columns.Add("IsBlackOut");
            foreach (DataRow row in dt.Rows)
            {
                GuestEnt model = GuestBll.GetModel(int.Parse(row["GuestId1"].ToString()));
                if (model != null)
                {
                    row["GuestId"] = model.GuestName;
                }
                DataRow[] rowArray = PublicAppliction.UserDt.Select("userid=" + row["UserId1"].ToString());
                if (rowArray.Length > 0)
                {
                    row["UserId"] = rowArray[0]["UserName"].ToString();
                }
                if (row["SaleVtag1"].ToString() == "0")
                {
                    row["SaleVtag"] = "等待确认";
                }
                else if (row["SaleVtag1"].ToString() == "1")
                {
                    row["SaleVtag"] = "等待收款";
                }
                else if (row["SaleVtag1"].ToString() == "2")
                {
                    row["SaleVtag"] = "已收款";
                }
                if (row["IsBlackOut1"].ToString() == "1")
                {
                    row["IsBlackOut"] = "作废";
                }
                else
                {
                    row["IsBlackOut"] = "否";
                }
            }
            dt.Columns.Remove("GuestId1");
            dt.Columns.Remove("UserId1");
            dt.Columns.Remove("SaleVtag1");
            dt.Columns.Remove("IsBlackOut1");
        }

        private void DatePageReadLoad()
        {
            this.DataGrid_bind();
            this.InitPage();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FrmOrdersList_Load(object sender, EventArgs e)
        {
            UserEnt loginUser = PublicAppliction.LoginUser;
            object text = this.lblWhere.Text;
            this.lblWhere.Text = string.Concat(new object[] { text, " where ChainNum=", loginUser.ChainNum, " and isout=0" });
            this.InitPage();
            base.CheckPopedom(this, this.DataGridList, this.CheckPopName, this.checkPopIsUse);
            ConfigEnt model = ConfigBll.GetModel(1);
            if ((model.IsUseMeUse != 1) && (this.checkPopIsUse[3] != "1"))
            {
                this.panel28.Visible = false;
            }
            if ((model.IsUseMeUse != 1) && (this.checkPopIsUse[4] != "1"))
            {
                this.panel4.Visible = false;
            }
            this.drpUserList.Items.Clear();
            this.drpUserList.BeginUpdate();
            foreach (DataRow row in PublicAppliction.UserDt.Rows)
            {
                this.drpUserList.AddItem(row["UserName"].ToString(), row["UserId"].ToString());
            }
            this.drpUserList.EndUpdate();
            this.DataGridList.ClearSelection();
        }

        private string GetSelectId(int types)
        {
            string str;
            int num;
            if (types == 0)
            {
                str = "";
                for (num = 0; num < this.DataGridList.Rows.Count; num++)
                {
                    if (this.DataGridList.Rows[num].Cells[0].FormattedValue.ToString() == "True")
                    {
                        str = str + this.DataGridList.Rows[num].Cells[1].Value + ",";
                    }
                }
                return str;
            }
            int num2 = 0;
            str = "";
            for (num = 0; num < this.DataGridList.Rows.Count; num++)
            {
                if (this.DataGridList.Rows[num].Cells[0].FormattedValue.ToString() == "True")
                {
                    str = str + this.DataGridList.Rows[num].Cells[1].Value + ",";
                    num2++;
                }
            }
            if (num2 > 1)
            {
                MessageBox.Show("只能选择一项", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return "";
            }
            return str.Replace(",", "");
        }

        private void InitializeComponent()
        {
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            DataGridViewCellStyle style2 = new DataGridViewCellStyle();
            DataGridViewCellStyle style3 = new DataGridViewCellStyle();
            DataGridViewCellStyle style4 = new DataGridViewCellStyle();
            DataGridViewCellStyle style5 = new DataGridViewCellStyle();
            DataGridViewCellStyle style6 = new DataGridViewCellStyle();
            DataGridViewCellStyle style7 = new DataGridViewCellStyle();
            DataGridViewCellStyle style8 = new DataGridViewCellStyle();
            DataGridViewCellStyle style9 = new DataGridViewCellStyle();
            DataGridViewCellStyle style10 = new DataGridViewCellStyle();
            DataGridViewCellStyle style11 = new DataGridViewCellStyle();
            DataGridViewCellStyle style12 = new DataGridViewCellStyle();
            DataGridViewCellStyle style13 = new DataGridViewCellStyle();
            this.panel1 = new Panel();
            this.panel27 = new Panel();
            this.pic_Help = new PictureBox();
            this.panel7 = new Panel();
            this.btnSearch = new Button();
            this.panel16 = new Panel();
            this.btnSearchHidden = new Button();
            this.panel5 = new Panel();
            this.btnAddNew = new Button();
            this.panel6 = new Panel();
            this.btnSelectAll = new Button();
            this.panel14 = new Panel();
            this.btnChongAll = new Button();
            this.panel15 = new Panel();
            this.btnDelele = new Button();
            this.panel28 = new Panel();
            this.btn_SeeZj = new Button();
            this.panel4 = new Panel();
            this.btn_ZuoFei = new Button();
            this.panel3 = new Panel();
            this.panel2 = new Panel();
            this.pan_Dock = new Panel();
            this.pan_AllPanel = new Panel();
            this.pan_AllPlanes = new Panel();
            this.DataGridList = new DataGridView();
            this.chk_chkItem = new DataGridViewCheckBoxColumn();
            this.OrdersId = new DataGridViewTextBoxColumn();
            this.OrderNum = new DataGridViewTextBoxColumn();
            this.GuestId = new DataGridViewTextBoxColumn();
            this.UserId = new DataGridViewTextBoxColumn();
            this.CreateTime = new DataGridViewTextBoxColumn();
            this.ToMeetMoney = new DataGridViewTextBoxColumn();
            this.SaleVtag = new DataGridViewTextBoxColumn();
            this.IsBlackOut = new DataGridViewTextBoxColumn();
            this.BlackManName = new DataGridViewTextBoxColumn();
            this.BlackTime = new DataGridViewTextBoxColumn();
            this.imgEdit = new DataGridViewImageColumn();
            this.imgDelete = new DataGridViewImageColumn();
            this.PlSearch2 = new Panel();
            this.panel30 = new Panel();
            this.drpUserList = new ComboBoxNew();
            this.panel31 = new Panel();
            this.label6 = new Label();
            this.panel26 = new Panel();
            this.chk_IsZuoFei = new CheckBox();
            this.chk_ShouKuan = new CheckBox();
            this.chk_IsQuHuo = new CheckBox();
            this.panel17 = new Panel();
            this.label5 = new Label();
            this.PlSearch = new Panel();
            this.panel24 = new Panel();
            this.label2 = new Label();
            this.dateTime_EndTime = new DateTimePicker();
            this.dateTime_BeginTime = new DateTimePicker();
            this.panel25 = new Panel();
            this.lbl_CreateTime = new Label();
            this.panel18 = new Panel();
            this.txt_GuestName = new TextBox();
            this.panel21 = new Panel();
            this.lbl_GuestName = new Label();
            this.panel19 = new Panel();
            this.txt_EndMoney = new TextBox();
            this.label4 = new Label();
            this.txt_BeginMoney = new TextBox();
            this.panel20 = new Panel();
            this.label3 = new Label();
            this.panel22 = new Panel();
            this.txt_IdDocument = new TextBox();
            this.panel23 = new Panel();
            this.lbl_Idcoument = new Label();
            this.panel13 = new Panel();
            this.panel10 = new Panel();
            this.panel12 = new Panel();
            this.lblWhere = new Label();
            this.panel11 = new Panel();
            this.navigator_Page = new Navigator();
            this.panel9 = new Panel();
            this.panel8 = new Panel();
            this.pan_TopJianGe = new Panel();
            this.pan_Rights = new Panel();
            this.pan_Lefts = new Panel();
            this.pan_Bottoms = new Panel();
            this.pane_TopT = new Panel();
            this.pan_DockBottom = new Panel();
            this.pan_DockRight = new Panel();
            this.pan_DockLeft = new Panel();
            this.label1 = new Label();
            this.pan_Top = new Panel();
            this.pan_ZhongJian = new Panel();
            this.pan_TopRight = new Panel();
            this.pan_TopLeft = new Panel();
            this.panel1.SuspendLayout();
            this.panel27.SuspendLayout();
            ((ISupportInitialize) this.pic_Help).BeginInit();
            this.panel7.SuspendLayout();
            this.panel16.SuspendLayout();
            this.panel5.SuspendLayout();
            this.panel6.SuspendLayout();
            this.panel14.SuspendLayout();
            this.panel15.SuspendLayout();
            this.panel28.SuspendLayout();
            this.panel4.SuspendLayout();
            this.pan_Dock.SuspendLayout();
            this.pan_AllPanel.SuspendLayout();
            this.pan_AllPlanes.SuspendLayout();
            ((ISupportInitialize) this.DataGridList).BeginInit();
            this.PlSearch2.SuspendLayout();
            this.panel30.SuspendLayout();
            this.panel31.SuspendLayout();
            this.panel26.SuspendLayout();
            this.panel17.SuspendLayout();
            this.PlSearch.SuspendLayout();
            this.panel24.SuspendLayout();
            this.panel25.SuspendLayout();
            this.panel18.SuspendLayout();
            this.panel21.SuspendLayout();
            this.panel19.SuspendLayout();
            this.panel20.SuspendLayout();
            this.panel22.SuspendLayout();
            this.panel23.SuspendLayout();
            this.panel10.SuspendLayout();
            this.panel12.SuspendLayout();
            this.panel11.SuspendLayout();
            this.pan_Top.SuspendLayout();
            this.pan_ZhongJian.SuspendLayout();
            base.SuspendLayout();
            this.panel1.BackColor = Color.FromArgb(0xf6, 0xf6, 0xf6);
            this.panel1.Controls.Add(this.panel27);
            this.panel1.Controls.Add(this.panel7);
            this.panel1.Controls.Add(this.panel16);
            this.panel1.Controls.Add(this.panel5);
            this.panel1.Controls.Add(this.panel6);
            this.panel1.Controls.Add(this.panel14);
            this.panel1.Controls.Add(this.panel15);
            this.panel1.Controls.Add(this.panel28);
            this.panel1.Controls.Add(this.panel4);
            this.panel1.Controls.Add(this.panel3);
            this.panel1.Controls.Add(this.panel2);
            this.panel1.Dock = DockStyle.Top;
            this.panel1.Location = new Point(0, 8);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x3f6, 0x1a);
            this.panel1.TabIndex = 1;
            this.panel27.Controls.Add(this.pic_Help);
            this.panel27.Dock = DockStyle.Right;
            this.panel27.Location = new Point(280, 3);
            this.panel27.Name = "panel27";
            this.panel27.Size = new Size(0x16, 20);
            this.panel27.TabIndex = 0x1c;
            this.pic_Help.BackgroundImage = Resources.question11;
            this.pic_Help.Cursor = Cursors.Hand;
            this.pic_Help.Location = new Point(3, 2);
            this.pic_Help.Name = "pic_Help";
            this.pic_Help.Size = new Size(0x10, 0x10);
            this.pic_Help.TabIndex = 8;
            this.pic_Help.TabStop = false;
            this.pic_Help.Click += new EventHandler(this.pic_Help_Click);
            this.panel7.Controls.Add(this.btnSearch);
            this.panel7.Dock = DockStyle.Right;
            this.panel7.Location = new Point(0x12e, 3);
            this.panel7.Name = "panel7";
            this.panel7.Size = new Size(0x59, 20);
            this.panel7.TabIndex = 0x1b;
            this.btnSearch.Dock = DockStyle.Right;
            this.btnSearch.Location = new Point(14, 0);
            this.btnSearch.Name = "btnSearch";
            this.btnSearch.Size = new Size(0x4b, 20);
            this.btnSearch.TabIndex = 1;
            this.btnSearch.Text = "查 询";
            this.btnSearch.UseVisualStyleBackColor = true;
            this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
            this.panel16.Controls.Add(this.btnSearchHidden);
            this.panel16.Dock = DockStyle.Right;
            this.panel16.Location = new Point(0x187, 3);
            this.panel16.Name = "panel16";
            this.panel16.Size = new Size(0x59, 20);
            this.panel16.TabIndex = 0x1a;
            this.btnSearchHidden.Dock = DockStyle.Right;
            this.btnSearchHidden.Location = new Point(14, 0);
            this.btnSearchHidden.Name = "btnSearchHidden";
            this.btnSearchHidden.Size = new Size(0x4b, 20);
            this.btnSearchHidden.TabIndex = 0;
            this.btnSearchHidden.Text = "显示查询";
            this.btnSearchHidden.UseVisualStyleBackColor = true;
            this.btnSearchHidden.Click += new EventHandler(this.btnSearchHidden_Click);
            this.panel5.Controls.Add(this.btnAddNew);
            this.panel5.Dock = DockStyle.Right;
            this.panel5.Location = new Point(480, 3);
            this.panel5.Name = "panel5";
            this.panel5.Size = new Size(0x59, 20);
            this.panel5.TabIndex = 0x19;
            this.btnAddNew.Dock = DockStyle.Right;
            this.btnAddNew.Location = new Point(14, 0);
            this.btnAddNew.Name = "btnAddNew";
            this.btnAddNew.Size = new Size(0x4b, 20);
            this.btnAddNew.TabIndex = 0;
            this.btnAddNew.Text = "新 增";
            this.btnAddNew.UseVisualStyleBackColor = true;
            this.btnAddNew.Click += new EventHandler(this.btnAddNew_Click);
            this.panel6.Controls.Add(this.btnSelectAll);
            this.panel6.Dock = DockStyle.Right;
            this.panel6.Location = new Point(0x239, 3);
            this.panel6.Name = "panel6";
            this.panel6.Size = new Size(0x59, 20);
            this.panel6.TabIndex = 0x18;
            this.btnSelectAll.Dock = DockStyle.Right;
            this.btnSelectAll.Location = new Point(14, 0);
            this.btnSelectAll.Name = "btnSelectAll";
            this.btnSelectAll.Size = new Size(0x4b, 20);
            this.btnSelectAll.TabIndex = 0;
            this.btnSelectAll.Text = "全 选";
            this.btnSelectAll.UseVisualStyleBackColor = true;
            this.btnSelectAll.Click += new EventHandler(this.btnSelectAll_Click);
            this.panel14.Controls.Add(this.btnChongAll);
            this.panel14.Dock = DockStyle.Right;
            this.panel14.Location = new Point(0x292, 3);
            this.panel14.Name = "panel14";
            this.panel14.Size = new Size(0x59, 20);
            this.panel14.TabIndex = 0x17;
            this.btnChongAll.Dock = DockStyle.Right;
            this.btnChongAll.Location = new Point(14, 0);
            this.btnChongAll.Name = "btnChongAll";
            this.btnChongAll.Size = new Size(0x4b, 20);
            this.btnChongAll.TabIndex = 0;
            this.btnChongAll.Text = "重 选";
            this.btnChongAll.UseVisualStyleBackColor = true;
            this.btnChongAll.Click += new EventHandler(this.btnChongAll_Click);
            this.panel15.Controls.Add(this.btnDelele);
            this.panel15.Dock = DockStyle.Right;
            this.panel15.Location = new Point(0x2eb, 3);
            this.panel15.Name = "panel15";
            this.panel15.Size = new Size(0x59, 20);
            this.panel15.TabIndex = 0x16;
            this.btnDelele.Dock = DockStyle.Right;
            this.btnDelele.Location = new Point(14, 0);
            this.btnDelele.Name = "btnDelele";
            this.btnDelele.Size = new Size(0x4b, 20);
            this.btnDelele.TabIndex = 0;
            this.btnDelele.Text = "删 除";
            this.btnDelele.UseVisualStyleBackColor = true;
            this.btnDelele.Click += new EventHandler(this.btnDelele_Click);
            this.panel28.Controls.Add(this.btn_SeeZj);
            this.panel28.Dock = DockStyle.Right;
            this.panel28.Location = new Point(0x344, 3);
            this.panel28.Name = "panel28";
            this.panel28.Size = new Size(0x59, 20);
            this.panel28.TabIndex = 0x15;
            this.btn_SeeZj.Dock = DockStyle.Right;
            this.btn_SeeZj.Location = new Point(14, 0);
            this.btn_SeeZj.Name = "btn_SeeZj";
            this.btn_SeeZj.Size = new Size(0x4b, 20);
            this.btn_SeeZj.TabIndex = 1;
            this.btn_SeeZj.Text = "确 认";
            this.btn_SeeZj.UseVisualStyleBackColor = true;
            this.btn_SeeZj.Click += new EventHandler(this.btn_SeeZj_Click);
            this.panel4.Controls.Add(this.btn_ZuoFei);
            this.panel4.Dock = DockStyle.Right;
            this.panel4.Location = new Point(0x39d, 3);
            this.panel4.Name = "panel4";
            this.panel4.Size = new Size(0x59, 20);
            this.panel4.TabIndex = 2;
            this.btn_ZuoFei.Dock = DockStyle.Right;
            this.btn_ZuoFei.Location = new Point(14, 0);
            this.btn_ZuoFei.Name = "btn_ZuoFei";
            this.btn_ZuoFei.Size = new Size(0x4b, 20);
            this.btn_ZuoFei.TabIndex = 2;
            this.btn_ZuoFei.Text = "作 废";
            this.btn_ZuoFei.UseVisualStyleBackColor = true;
            this.btn_ZuoFei.Click += new EventHandler(this.btn_ZuoFei_Click);
            this.panel3.Dock = DockStyle.Bottom;
            this.panel3.Location = new Point(0, 0x17);
            this.panel3.Name = "panel3";
            this.panel3.Size = new Size(0x3f6, 3);
            this.panel3.TabIndex = 1;
            this.panel2.Dock = DockStyle.Top;
            this.panel2.Location = new Point(0, 0);
            this.panel2.Name = "panel2";
            this.panel2.Size = new Size(0x3f6, 3);
            this.panel2.TabIndex = 0;
            this.pan_Dock.BackColor = Color.FromArgb(0, 0, 15, 0xff);
            this.pan_Dock.Controls.Add(this.pan_AllPanel);
            this.pan_Dock.Controls.Add(this.pan_DockBottom);
            this.pan_Dock.Controls.Add(this.pan_DockRight);
            this.pan_Dock.Controls.Add(this.pan_DockLeft);
            this.pan_Dock.Dock = DockStyle.Fill;
            this.pan_Dock.Location = new Point(0, 0x20);
            this.pan_Dock.Name = "pan_Dock";
            this.pan_Dock.Size = new Size(0x40c, 0x201);
            this.pan_Dock.TabIndex = 5;
            this.pan_AllPanel.BackColor = Color.White;
            this.pan_AllPanel.Controls.Add(this.pan_AllPlanes);
            this.pan_AllPanel.Controls.Add(this.pan_Rights);
            this.pan_AllPanel.Controls.Add(this.pan_Lefts);
            this.pan_AllPanel.Controls.Add(this.pan_Bottoms);
            this.pan_AllPanel.Controls.Add(this.pane_TopT);
            this.pan_AllPanel.Dock = DockStyle.Fill;
            this.pan_AllPanel.Location = new Point(1, 0);
            this.pan_AllPanel.Name = "pan_AllPanel";
            this.pan_AllPanel.Size = new Size(0x40a, 0x200);
            this.pan_AllPanel.TabIndex = 3;
            this.pan_AllPlanes.Controls.Add(this.DataGridList);
            this.pan_AllPlanes.Controls.Add(this.PlSearch2);
            this.pan_AllPlanes.Controls.Add(this.PlSearch);
            this.pan_AllPlanes.Controls.Add(this.panel13);
            this.pan_AllPlanes.Controls.Add(this.panel10);
            this.pan_AllPlanes.Controls.Add(this.panel9);
            this.pan_AllPlanes.Controls.Add(this.panel8);
            this.pan_AllPlanes.Controls.Add(this.panel1);
            this.pan_AllPlanes.Controls.Add(this.pan_TopJianGe);
            this.pan_AllPlanes.Dock = DockStyle.Fill;
            this.pan_AllPlanes.Location = new Point(10, 10);
            this.pan_AllPlanes.Name = "pan_AllPlanes";
            this.pan_AllPlanes.Size = new Size(0x3f6, 0x1ec);
            this.pan_AllPlanes.TabIndex = 4;
            this.DataGridList.AllowUserToAddRows = false;
            this.DataGridList.AllowUserToDeleteRows = false;
            style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style.BackColor = Color.FromArgb(0xf9, 0xf9, 0xf9);
            this.DataGridList.AlternatingRowsDefaultCellStyle = style;
            this.DataGridList.BackgroundColor = Color.WhiteSmoke;
            this.DataGridList.BorderStyle = BorderStyle.None;
            style2.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style2.BackColor = Color.White;
            style2.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style2.ForeColor = SystemColors.WindowText;
            style2.SelectionBackColor = SystemColors.Highlight;
            style2.SelectionForeColor = SystemColors.HighlightText;
            this.DataGridList.ColumnHeadersDefaultCellStyle = style2;
            this.DataGridList.Columns.AddRange(new DataGridViewColumn[] { this.chk_chkItem, this.OrdersId, this.OrderNum, this.GuestId, this.UserId, this.CreateTime, this.ToMeetMoney, this.SaleVtag, this.IsBlackOut, this.BlackManName, this.BlackTime, this.imgEdit, this.imgDelete });
            style3.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style3.BackColor = SystemColors.Window;
            style3.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style3.ForeColor = SystemColors.ControlText;
            style3.SelectionBackColor = SystemColors.Highlight;
            style3.SelectionForeColor = SystemColors.HighlightText;
            style3.WrapMode = DataGridViewTriState.False;
            this.DataGridList.DefaultCellStyle = style3;
            this.DataGridList.Dock = DockStyle.Fill;
            this.DataGridList.EnableHeadersVisualStyles = false;
            this.DataGridList.GridColor = Color.FromArgb(0xab, 0xb9, 0x9d);
            this.DataGridList.Location = new Point(0, 0x60);
            this.DataGridList.Name = "DataGridList";
            style4.Alignment = DataGridViewContentAlignment.BottomCenter;
            style4.BackColor = Color.White;
            style4.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style4.ForeColor = SystemColors.WindowText;
            style4.SelectionBackColor = SystemColors.Highlight;
            style4.SelectionForeColor = SystemColors.HighlightText;
            this.DataGridList.RowHeadersDefaultCellStyle = style4;
            style5.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.DataGridList.RowsDefaultCellStyle = style5;
            this.DataGridList.RowTemplate.Height = 0x17;
            this.DataGridList.Size = new Size(0x3f6, 0x163);
            this.DataGridList.TabIndex = 9;
            this.DataGridList.CellDoubleClick += new DataGridViewCellEventHandler(this.DataGridList_CellDoubleClick);
            this.DataGridList.CellClick += new DataGridViewCellEventHandler(this.DataGridList_CellClick);
            style6.NullValue = false;
            this.chk_chkItem.DefaultCellStyle = style6;
            this.chk_chkItem.FalseValue = "false";
            this.chk_chkItem.HeaderText = "选项";
            this.chk_chkItem.IndeterminateValue = "";
            this.chk_chkItem.Name = "chk_chkItem";
            this.chk_chkItem.TrueValue = "true";
            this.chk_chkItem.Width = 50;
            this.OrdersId.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.OrdersId.DataPropertyName = "OrdersId";
            style7.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style7.BackColor = Color.White;
            this.OrdersId.DefaultCellStyle = style7;
            this.OrdersId.HeaderText = "订单id";
            this.OrdersId.Name = "OrdersId";
            this.OrdersId.ReadOnly = true;
            this.OrdersId.Visible = false;
            this.OrderNum.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.OrderNum.DataPropertyName = "OrderNum";
            style8.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style8.BackColor = Color.White;
            this.OrderNum.DefaultCellStyle = style8;
            this.OrderNum.HeaderText = "销售单据";
            this.OrderNum.Name = "OrderNum";
            this.OrderNum.ReadOnly = true;
            this.GuestId.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.GuestId.DataPropertyName = "GuestId";
            style9.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style9.BackColor = Color.White;
            this.GuestId.DefaultCellStyle = style9;
            this.GuestId.HeaderText = "客户";
            this.GuestId.Name = "GuestId";
            this.GuestId.ReadOnly = true;
            this.UserId.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.UserId.DataPropertyName = "UserId";
            style10.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style10.BackColor = Color.White;
            this.UserId.DefaultCellStyle = style10;
            this.UserId.HeaderText = "销售人员";
            this.UserId.Name = "UserId";
            this.UserId.ReadOnly = true;
            this.CreateTime.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.CreateTime.DataPropertyName = "CreateTime";
            style11.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style11.BackColor = Color.White;
            this.CreateTime.DefaultCellStyle = style11;
            this.CreateTime.HeaderText = "销售时间";
            this.CreateTime.Name = "CreateTime";
            this.CreateTime.ReadOnly = true;
            this.ToMeetMoney.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.ToMeetMoney.DataPropertyName = "ToMeetMoney";
            style12.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style12.BackColor = Color.White;
            this.ToMeetMoney.DefaultCellStyle = style12;
            this.ToMeetMoney.HeaderText = "销售金额";
            this.ToMeetMoney.Name = "ToMeetMoney";
            this.ToMeetMoney.ReadOnly = true;
            this.SaleVtag.DataPropertyName = "SaleVtag";
            this.SaleVtag.HeaderText = "销售状态";
            this.SaleVtag.Name = "SaleVtag";
            this.IsBlackOut.DataPropertyName = "IsBlackOut";
            style13.ForeColor = Color.Red;
            this.IsBlackOut.DefaultCellStyle = style13;
            this.IsBlackOut.HeaderText = "是否作废";
            this.IsBlackOut.Name = "IsBlackOut";
            this.BlackManName.DataPropertyName = "BlackManName";
            this.BlackManName.HeaderText = "作废人";
            this.BlackManName.Name = "BlackManName";
            this.BlackManName.Visible = false;
            this.BlackTime.DataPropertyName = "BlackTime";
            this.BlackTime.HeaderText = "作废时间";
            this.BlackTime.Name = "BlackTime";
            this.BlackTime.Visible = false;
            this.imgEdit.HeaderText = "编辑";
            this.imgEdit.Image = Resources.EditBtn;
            this.imgEdit.Name = "imgEdit";
            this.imgEdit.Width = 60;
            this.imgDelete.HeaderText = "删除";
            this.imgDelete.Image = Resources.DeleteBtn;
            this.imgDelete.Name = "imgDelete";
            this.imgDelete.Width = 60;
            this.PlSearch2.Controls.Add(this.panel30);
            this.PlSearch2.Controls.Add(this.panel31);
            this.PlSearch2.Controls.Add(this.panel26);
            this.PlSearch2.Controls.Add(this.panel17);
            this.PlSearch2.Dock = DockStyle.Top;
            this.PlSearch2.Location = new Point(0, 0x45);
            this.PlSearch2.Name = "PlSearch2";
            this.PlSearch2.Size = new Size(0x3f6, 0x1b);
            this.PlSearch2.TabIndex = 7;
            this.PlSearch2.Visible = false;
            this.panel30.Controls.Add(this.drpUserList);
            this.panel30.Dock = DockStyle.Left;
            this.panel30.Location = new Point(0x161, 0);
            this.panel30.Name = "panel30";
            this.panel30.Size = new Size(0x92, 0x1b);
            this.panel30.TabIndex = 0x1c;
            this.drpUserList.DisplayMember = "Name";
            this.drpUserList.DropDownStyle = ComboBoxStyle.DropDownList;
            this.drpUserList.FormattingEnabled = true;
            this.drpUserList.Location = new Point(4, 3);
            this.drpUserList.Name = "drpUserList";
            this.drpUserList.SelectValueNew = "";
            this.drpUserList.Size = new Size(0x8a, 20);
            this.drpUserList.TabIndex = 0;
            this.drpUserList.ValueMember = "Value";
            this.panel31.Controls.Add(this.label6);
            this.panel31.Dock = DockStyle.Left;
            this.panel31.Location = new Point(0x11c, 0);
            this.panel31.Name = "panel31";
            this.panel31.Size = new Size(0x45, 0x1b);
            this.panel31.TabIndex = 0x1b;
            this.label6.AutoSize = true;
            this.label6.Location = new Point(5, 7);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0x3b, 12);
            this.label6.TabIndex = 0;
            this.label6.Text = "销售人员:";
            this.panel26.Controls.Add(this.chk_IsZuoFei);
            this.panel26.Controls.Add(this.chk_ShouKuan);
            this.panel26.Controls.Add(this.chk_IsQuHuo);
            this.panel26.Dock = DockStyle.Left;
            this.panel26.Location = new Point(0x45, 0);
            this.panel26.Name = "panel26";
            this.panel26.Size = new Size(0xd7, 0x1b);
            this.panel26.TabIndex = 0x1a;
            this.chk_IsZuoFei.AutoSize = true;
            this.chk_IsZuoFei.Location = new Point(0x8d, 5);
            this.chk_IsZuoFei.Name = "chk_IsZuoFei";
            this.chk_IsZuoFei.Size = new Size(60, 0x10);
            this.chk_IsZuoFei.TabIndex = 2;
            this.chk_IsZuoFei.Text = "已作废";
            this.chk_IsZuoFei.UseVisualStyleBackColor = true;
            this.chk_ShouKuan.AutoSize = true;
            this.chk_ShouKuan.Location = new Point(0x4b, 5);
            this.chk_ShouKuan.Name = "chk_ShouKuan";
            this.chk_ShouKuan.Size = new Size(60, 0x10);
            this.chk_ShouKuan.TabIndex = 1;
            this.chk_ShouKuan.Text = "已收款";
            this.chk_ShouKuan.UseVisualStyleBackColor = true;
            this.chk_IsQuHuo.AutoSize = true;
            this.chk_IsQuHuo.Location = new Point(9, 5);
            this.chk_IsQuHuo.Name = "chk_IsQuHuo";
            this.chk_IsQuHuo.Size = new Size(60, 0x10);
            this.chk_IsQuHuo.TabIndex = 0;
            this.chk_IsQuHuo.Text = "已取货";
            this.chk_IsQuHuo.UseVisualStyleBackColor = true;
            this.panel17.Controls.Add(this.label5);
            this.panel17.Dock = DockStyle.Left;
            this.panel17.Location = new Point(0, 0);
            this.panel17.Name = "panel17";
            this.panel17.Size = new Size(0x45, 0x1b);
            this.panel17.TabIndex = 0x19;
            this.label5.AutoSize = true;
            this.label5.Location = new Point(5, 7);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x3b, 12);
            this.label5.TabIndex = 0;
            this.label5.Text = "销售状态:";
            this.PlSearch.Controls.Add(this.panel24);
            this.PlSearch.Controls.Add(this.panel25);
            this.PlSearch.Controls.Add(this.panel18);
            this.PlSearch.Controls.Add(this.panel21);
            this.PlSearch.Controls.Add(this.panel19);
            this.PlSearch.Controls.Add(this.panel20);
            this.PlSearch.Controls.Add(this.panel22);
            this.PlSearch.Controls.Add(this.panel23);
            this.PlSearch.Dock = DockStyle.Top;
            this.PlSearch.Location = new Point(0, 0x2a);
            this.PlSearch.Name = "PlSearch";
            this.PlSearch.Size = new Size(0x3f6, 0x1b);
            this.PlSearch.TabIndex = 6;
            this.PlSearch.Visible = false;
            this.panel24.Controls.Add(this.label2);
            this.panel24.Controls.Add(this.dateTime_EndTime);
            this.panel24.Controls.Add(this.dateTime_BeginTime);
            this.panel24.Dock = DockStyle.Left;
            this.panel24.Location = new Point(680, 0);
            this.panel24.Name = "panel24";
            this.panel24.Size = new Size(0x105, 0x1b);
            this.panel24.TabIndex = 0x17;
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0x7b, 7);
            this.label2.Name = "label2";
            this.label2.Size = new Size(11, 12);
            this.label2.TabIndex = 2;
            this.label2.Text = "-";
            this.dateTime_EndTime.Location = new Point(140, 3);
            this.dateTime_EndTime.Name = "dateTime_EndTime";
            this.dateTime_EndTime.Size = new Size(0x73, 0x15);
            this.dateTime_EndTime.TabIndex = 1;
            this.dateTime_BeginTime.Location = new Point(3, 3);
            this.dateTime_BeginTime.Name = "dateTime_BeginTime";
            this.dateTime_BeginTime.Size = new Size(0x73, 0x15);
            this.dateTime_BeginTime.TabIndex = 0;
            this.panel25.Controls.Add(this.lbl_CreateTime);
            this.panel25.Dock = DockStyle.Left;
            this.panel25.Location = new Point(0x263, 0);
            this.panel25.Name = "panel25";
            this.panel25.Size = new Size(0x45, 0x1b);
            this.panel25.TabIndex = 0x16;
            this.lbl_CreateTime.AutoSize = true;
            this.lbl_CreateTime.Location = new Point(5, 7);
            this.lbl_CreateTime.Name = "lbl_CreateTime";
            this.lbl_CreateTime.Size = new Size(0x3b, 12);
            this.lbl_CreateTime.TabIndex = 0;
            this.lbl_CreateTime.Text = "销售时间:";
            this.panel18.Controls.Add(this.txt_GuestName);
            this.panel18.Dock = DockStyle.Left;
            this.panel18.Location = new Point(0x1f3, 0);
            this.panel18.Name = "panel18";
            this.panel18.Size = new Size(0x70, 0x1b);
            this.panel18.TabIndex = 0x15;
            this.txt_GuestName.Location = new Point(5, 3);
            this.txt_GuestName.Name = "txt_GuestName";
            this.txt_GuestName.Size = new Size(0x68, 0x15);
            this.txt_GuestName.TabIndex = 0;
            this.panel21.Controls.Add(this.lbl_GuestName);
            this.panel21.Dock = DockStyle.Left;
            this.panel21.Location = new Point(430, 0);
            this.panel21.Name = "panel21";
            this.panel21.Size = new Size(0x45, 0x1b);
            this.panel21.TabIndex = 20;
            this.lbl_GuestName.AutoSize = true;
            this.lbl_GuestName.Location = new Point(5, 7);
            this.lbl_GuestName.Name = "lbl_GuestName";
            this.lbl_GuestName.Size = new Size(0x3b, 12);
            this.lbl_GuestName.TabIndex = 0;
            this.lbl_GuestName.Text = "客户姓名:";
            this.panel19.Controls.Add(this.txt_EndMoney);
            this.panel19.Controls.Add(this.label4);
            this.panel19.Controls.Add(this.txt_BeginMoney);
            this.panel19.Dock = DockStyle.Left;
            this.panel19.Location = new Point(0x11c, 0);
            this.panel19.Name = "panel19";
            this.panel19.Size = new Size(0x92, 0x1b);
            this.panel19.TabIndex = 0x13;
            this.txt_EndMoney.Location = new Point(0x55, 3);
            this.txt_EndMoney.Name = "txt_EndMoney";
            this.txt_EndMoney.Size = new Size(0x3a, 0x15);
            this.txt_EndMoney.TabIndex = 2;
            this.label4.AutoSize = true;
            this.label4.Location = new Point(0x44, 6);
            this.label4.Name = "label4";
            this.label4.Size = new Size(11, 12);
            this.label4.TabIndex = 1;
            this.label4.Text = "-";
            this.txt_BeginMoney.Location = new Point(3, 3);
            this.txt_BeginMoney.Name = "txt_BeginMoney";
            this.txt_BeginMoney.Size = new Size(0x3b, 0x15);
            this.txt_BeginMoney.TabIndex = 0;
            this.panel20.Controls.Add(this.label3);
            this.panel20.Dock = DockStyle.Left;
            this.panel20.Location = new Point(0xd7, 0);
            this.panel20.Name = "panel20";
            this.panel20.Size = new Size(0x45, 0x1b);
            this.panel20.TabIndex = 0x12;
            this.label3.AutoSize = true;
            this.label3.Location = new Point(6, 6);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x3b, 12);
            this.label3.TabIndex = 0;
            this.label3.Text = "销售金额:";
            this.panel22.Controls.Add(this.txt_IdDocument);
            this.panel22.Dock = DockStyle.Left;
            this.panel22.Location = new Point(0x45, 0);
            this.panel22.Name = "panel22";
            this.panel22.Size = new Size(0x92, 0x1b);
            this.panel22.TabIndex = 0x11;
            this.txt_IdDocument.Location = new Point(5, 3);
            this.txt_IdDocument.Name = "txt_IdDocument";
            this.txt_IdDocument.Size = new Size(0x89, 0x15);
            this.txt_IdDocument.TabIndex = 0;
            this.panel23.Controls.Add(this.lbl_Idcoument);
            this.panel23.Dock = DockStyle.Left;
            this.panel23.Location = new Point(0, 0);
            this.panel23.Name = "panel23";
            this.panel23.Size = new Size(0x45, 0x1b);
            this.panel23.TabIndex = 0x10;
            this.lbl_Idcoument.AutoSize = true;
            this.lbl_Idcoument.Location = new Point(5, 6);
            this.lbl_Idcoument.Name = "lbl_Idcoument";
            this.lbl_Idcoument.Size = new Size(0x3b, 12);
            this.lbl_Idcoument.TabIndex = 0;
            this.lbl_Idcoument.Text = "单据编号:";
            this.panel13.Dock = DockStyle.Bottom;
            this.panel13.Location = new Point(0, 0x1c3);
            this.panel13.Name = "panel13";
            this.panel13.Size = new Size(0x3f6, 10);
            this.panel13.TabIndex = 5;
            this.panel10.BackColor = Color.FromArgb(0xca, 0xc9, 0xce);
            this.panel10.Controls.Add(this.panel12);
            this.panel10.Controls.Add(this.panel11);
            this.panel10.Dock = DockStyle.Bottom;
            this.panel10.Location = new Point(0, 0x1cd);
            this.panel10.Name = "panel10";
            this.panel10.Size = new Size(0x3f6, 0x1a);
            this.panel10.TabIndex = 4;
            this.panel12.Controls.Add(this.lblWhere);
            this.panel12.Dock = DockStyle.Fill;
            this.panel12.Location = new Point(0, 0);
            this.panel12.Name = "panel12";
            this.panel12.Size = new Size(0x239, 0x1a);
            this.panel12.TabIndex = 1;
            this.lblWhere.AutoSize = true;
            this.lblWhere.Dock = DockStyle.Right;
            this.lblWhere.Location = new Point(0x239, 0);
            this.lblWhere.Name = "lblWhere";
            this.lblWhere.Size = new Size(0, 12);
            this.lblWhere.TabIndex = 0;
            this.lblWhere.Visible = false;
            this.panel11.Controls.Add(this.navigator_Page);
            this.panel11.Dock = DockStyle.Right;
            this.panel11.Location = new Point(0x239, 0);
            this.panel11.Name = "panel11";
            this.panel11.Size = new Size(0x1bd, 0x1a);
            this.panel11.TabIndex = 0;
            this.navigator_Page.Dock = DockStyle.Bottom;
            this.navigator_Page.Location = new Point(0, 8);
            this.navigator_Page.Name = "navigator_Page";
            this.navigator_Page.PageSize = 20;
            this.navigator_Page.RowCount = 0;
            this.navigator_Page.Size = new Size(0x1bd, 0x12);
            this.navigator_Page.TabIndex = 0;
            this.navigator_Page.OnLoadViewStatus += new Navigator.LoadViewStatusHandler(this.navigator_Page_OnLoadViewStatus);
            this.panel9.Dock = DockStyle.Bottom;
            this.panel9.Location = new Point(0, 0x1e7);
            this.panel9.Name = "panel9";
            this.panel9.Size = new Size(0x3f6, 5);
            this.panel9.TabIndex = 3;
            this.panel8.Dock = DockStyle.Top;
            this.panel8.Location = new Point(0, 0x22);
            this.panel8.Name = "panel8";
            this.panel8.Size = new Size(0x3f6, 8);
            this.panel8.TabIndex = 2;
            this.pan_TopJianGe.Dock = DockStyle.Top;
            this.pan_TopJianGe.Location = new Point(0, 0);
            this.pan_TopJianGe.Name = "pan_TopJianGe";
            this.pan_TopJianGe.Size = new Size(0x3f6, 8);
            this.pan_TopJianGe.TabIndex = 0;
            this.pan_Rights.Dock = DockStyle.Right;
            this.pan_Rights.Location = new Point(0x400, 10);
            this.pan_Rights.Name = "pan_Rights";
            this.pan_Rights.Size = new Size(10, 0x1ec);
            this.pan_Rights.TabIndex = 3;
            this.pan_Lefts.Dock = DockStyle.Left;
            this.pan_Lefts.Location = new Point(0, 10);
            this.pan_Lefts.Name = "pan_Lefts";
            this.pan_Lefts.Size = new Size(10, 0x1ec);
            this.pan_Lefts.TabIndex = 2;
            this.pan_Bottoms.Dock = DockStyle.Bottom;
            this.pan_Bottoms.Location = new Point(0, 0x1f6);
            this.pan_Bottoms.Name = "pan_Bottoms";
            this.pan_Bottoms.Size = new Size(0x40a, 10);
            this.pan_Bottoms.TabIndex = 1;
            this.pane_TopT.Dock = DockStyle.Top;
            this.pane_TopT.Location = new Point(0, 0);
            this.pane_TopT.Name = "pane_TopT";
            this.pane_TopT.Size = new Size(0x40a, 10);
            this.pane_TopT.TabIndex = 0;
            this.pan_DockBottom.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockBottom.Dock = DockStyle.Bottom;
            this.pan_DockBottom.Location = new Point(1, 0x200);
            this.pan_DockBottom.Name = "pan_DockBottom";
            this.pan_DockBottom.Size = new Size(0x40a, 1);
            this.pan_DockBottom.TabIndex = 2;
            this.pan_DockRight.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockRight.Dock = DockStyle.Right;
            this.pan_DockRight.Location = new Point(0x40b, 0);
            this.pan_DockRight.Name = "pan_DockRight";
            this.pan_DockRight.Size = new Size(1, 0x201);
            this.pan_DockRight.TabIndex = 1;
            this.pan_DockLeft.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockLeft.Dock = DockStyle.Left;
            this.pan_DockLeft.Location = new Point(0, 0);
            this.pan_DockLeft.Name = "pan_DockLeft";
            this.pan_DockLeft.Size = new Size(1, 0x201);
            this.pan_DockLeft.TabIndex = 0;
            this.label1.AutoSize = true;
            this.label1.BackColor = Color.FromArgb(0, 0, 15, 0xff);
            this.label1.Font = new Font("宋体", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.label1.ForeColor = Color.FromArgb(0x3b, 0x56, 20);
            this.label1.Location = new Point(6, 8);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x3f, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "销售管理";
            this.pan_Top.Controls.Add(this.pan_ZhongJian);
            this.pan_Top.Controls.Add(this.pan_TopRight);
            this.pan_Top.Controls.Add(this.pan_TopLeft);
            this.pan_Top.Dock = DockStyle.Top;
            this.pan_Top.Location = new Point(0, 0);
            this.pan_Top.Name = "pan_Top";
            this.pan_Top.Size = new Size(0x40c, 0x20);
            this.pan_Top.TabIndex = 4;
            this.pan_ZhongJian.BackgroundImage = Resources.uc_title_2;
            this.pan_ZhongJian.Controls.Add(this.label1);
            this.pan_ZhongJian.Dock = DockStyle.Fill;
            this.pan_ZhongJian.Location = new Point(0x1f, 0);
            this.pan_ZhongJian.Name = "pan_ZhongJian";
            this.pan_ZhongJian.Size = new Size(0x3e8, 0x20);
            this.pan_ZhongJian.TabIndex = 2;
            this.pan_TopRight.BackgroundImage = Resources.uc_title_1;
            this.pan_TopRight.Dock = DockStyle.Right;
            this.pan_TopRight.Location = new Point(0x407, 0);
            this.pan_TopRight.Name = "pan_TopRight";
            this.pan_TopRight.Size = new Size(5, 0x20);
            this.pan_TopRight.TabIndex = 1;
            this.pan_TopLeft.BackgroundImage = Resources.uc_title;
            this.pan_TopLeft.Dock = DockStyle.Left;
            this.pan_TopLeft.Location = new Point(0, 0);
            this.pan_TopLeft.Name = "pan_TopLeft";
            this.pan_TopLeft.Size = new Size(0x1f, 0x20);
            this.pan_TopLeft.TabIndex = 0;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x40c, 0x221);
            base.Controls.Add(this.pan_Dock);
            base.Controls.Add(this.pan_Top);
            base.FormBorderStyle = FormBorderStyle.None;
            base.Name = "FrmOrdersList";
            this.Text = "FrmChain";
            base.Load += new EventHandler(this.FrmOrdersList_Load);
            this.panel1.ResumeLayout(false);
            this.panel27.ResumeLayout(false);
            ((ISupportInitialize) this.pic_Help).EndInit();
            this.panel7.ResumeLayout(false);
            this.panel16.ResumeLayout(false);
            this.panel5.ResumeLayout(false);
            this.panel6.ResumeLayout(false);
            this.panel14.ResumeLayout(false);
            this.panel15.ResumeLayout(false);
            this.panel28.ResumeLayout(false);
            this.panel4.ResumeLayout(false);
            this.pan_Dock.ResumeLayout(false);
            this.pan_AllPanel.ResumeLayout(false);
            this.pan_AllPlanes.ResumeLayout(false);
            ((ISupportInitialize) this.DataGridList).EndInit();
            this.PlSearch2.ResumeLayout(false);
            this.panel30.ResumeLayout(false);
            this.panel31.ResumeLayout(false);
            this.panel31.PerformLayout();
            this.panel26.ResumeLayout(false);
            this.panel26.PerformLayout();
            this.panel17.ResumeLayout(false);
            this.panel17.PerformLayout();
            this.PlSearch.ResumeLayout(false);
            this.panel24.ResumeLayout(false);
            this.panel24.PerformLayout();
            this.panel25.ResumeLayout(false);
            this.panel25.PerformLayout();
            this.panel18.ResumeLayout(false);
            this.panel18.PerformLayout();
            this.panel21.ResumeLayout(false);
            this.panel21.PerformLayout();
            this.panel19.ResumeLayout(false);
            this.panel19.PerformLayout();
            this.panel20.ResumeLayout(false);
            this.panel20.PerformLayout();
            this.panel22.ResumeLayout(false);
            this.panel22.PerformLayout();
            this.panel23.ResumeLayout(false);
            this.panel23.PerformLayout();
            this.panel10.ResumeLayout(false);
            this.panel12.ResumeLayout(false);
            this.panel12.PerformLayout();
            this.panel11.ResumeLayout(false);
            this.pan_Top.ResumeLayout(false);
            this.pan_ZhongJian.ResumeLayout(false);
            this.pan_ZhongJian.PerformLayout();
            base.ResumeLayout(false);
        }

        private void InitPage()
        {
            this.navigator_Page.PageSize = PublicAppliction.PageCount;
            this.navigator_Page.DataContainer = this.DataGridList;
            this.navigator_Page.Init();
        }

        private void navigator_Page_OnLoadViewStatus()
        {
            this.DataGrid_bind();
            this.navigator_Page.PageSize = PublicAppliction.PageCount;
            this.navigator_Page.DataContainer = this.DataGridList;
            this.navigator_Page.DataBind();
        }

        private bool PayForMyMoney(string orderid, string accountId, string paytypes)
        {
            OrdersEnt model = OrdersBll.GetModel(int.Parse(orderid));
            OrderPaymentEnt ent2 = new OrderPaymentEnt {
                PaymentNum = IdocumentCodeBll.GetMaxValue("SalesPayment"),
                GuestId = model.GuestId,
                AllMoney = model.ToMeetMoney,
                AccountId = int.Parse(accountId)
            };
            UserEnt loginUser = PublicAppliction.LoginUser;
            ent2.ChainNum = loginUser.ChainNum;
            ent2.CreateMan = loginUser.UserId;
            ent2.CreateTime = DateTime.Now;
            ent2.PayType = int.Parse(paytypes);
            ent2.TIN = "";
            ent2.BankName = "";
            ent2.BankNum = "";
            ent2.Remark = "";
            ent2.InvoicingNum = "";
            ent2.PayTime = DateTime.Now;
            OrderPaymentBll.Add(ent2);
            int maxId = OrderPaymentBll.GetMaxId("ChainNum=" + loginUser.ChainNum);
            ent2.PaymentId = maxId;
            this.AddLinkOrdersAndPayment(int.Parse(orderid), maxId, model.ToMeetMoney);
            this.CheckPayment(maxId.ToString(), orderid);
            return true;
        }

        private void pic_Help_Click(object sender, EventArgs e)
        {
            new FrmHelp(12).Show();
        }

        private bool StockCommOutPut(string id)
        {
            OrdersEnt model = OrdersBll.GetModel(int.Parse(id));
            switch (StockBll.OutDll(id))
            {
                case 1:
                    MessageBox.Show("库存不够请修改数量", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return false;

                case 2:
                    MessageBox.Show("部分商品未找到", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return false;
            }
            model.SaleVtag = 1;
            OrdersBll.UpdateSaleVag(model);
            model.IsReview = 1;
            UserEnt loginUser = PublicAppliction.LoginUser;
            model.ReviewMan = loginUser.UserId;
            model.ReviewTime = DateTime.Now;
            model.IsOut = 1;
            OrdersBll.FuCheck(model);
            return true;
        }
    }
}

